/*
 * @Description: 订阅激光点云信息，并解析数据，包装在sensor_msgs::PointCloud2
 * @Author: Sang Hao
 * @Date: 2021-09-15 17:10:53
 * @LastEditTime: 2021-10-27 13:35:22
 * @LastEditors: Sang Hao
 */
#ifndef LIDAR_SLAM_SUBSCRIBER_CLOUD_SUBSCRIBER_HPP_
#define LIDAR_SLAM_SUBSCRIBER_CLOUD_SUBSCRIBER_HPP_

#include <deque>

#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>

#include "lidar_slam/sensor_data/cloud_data.hpp"

namespace lidar_slam {
class CloudSubscriber {
private:
	/* data */
	ros::NodeHandle nh_;
	ros::Subscriber subscriber_;
	std::deque<CloudData> new_cloud_data_;

private:
	void msg_callback(const sensor_msgs::PointCloud2::ConstPtr& cloud_msg_ptr);

public:
	CloudSubscriber(ros::NodeHandle& nh, std::string topic_name, size_t buff_size);
	CloudSubscriber() = default;
	void ParseData(std::deque<CloudData>& deque_cloud_data);
};
}

#endif